<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;">
    <!-- main -->
    <div class="col">
        <!-- main header -->


        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12" ng-controller="gitlabVersionCtrl">
                    <h4 class="m-n font-thin h3 text-black">Gitlab仓库管理</h4>
                    <span class="label"
                          style="margin-left: 5px; background-color: #00a8f3; color: white;">Version{{version.version}}_{{version.revision}}</span>
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <!-- / toaster directive -->

            <uib-tabset>
                <uib-tab index="0" heading="仓库">
                    <div class="panel panel-default" ng-controller="projectCtrl">
                        <div class="panel-body">
                            <form class="form-inline" role="form">
                                <div class="form-group">
                                    <div class="input-group">
                                        <span class="input-group-addon">项目名</span>
                                        <input type="text" class="form-control" ng-model="queryName"
                                               placeholder="名称">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <button type="button" class="btn btn-info" ng-click="doQuery()"><span
                                            class="glyphicon glyphicon-search"></span>搜索
                                    </button>

                                </div>
                                <div class="form-group">
                                    <button type="button" class="btn btn-success" ng-click="updateProjects()">
                                        <i class="fa fa-spin fa-spinner" ng-show="btnUpdateing"></i>
                                        <i class="fa fa-circle-o-notch" ng-show="!btnUpdateing"></i>更新项目
                                    </button>

                                </div>
                            </form>

                            <div class="panel panel-default" style="margin-top: 5px;;">
                                <div class="panel-body">
                                    <div>
                                        <table class="table table-hover table-bordered table-striped">
                                            <thead>
                                            <tr>
                                                <td class="col-md-4">项目</td>
                                                <td>Branch</td>
                                                <td class="col-md-5">Tag</td>
                                                <td ng-if="contains(authPoint, '/server/save')">操作</td>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <tr ng-repeat="item in pageData">
                                                <td>
                                                    <b style="color: #286090;"
                                                          uib-popover-html="item.description"
                                                          popover-trigger="'mouseenter'">{{item.name}}</b>
                                                    </br>
                                                    <a href={{item.webUrl}} target="_blank"><b style="color: #777">{{item.sshUrl}}</b></a>
                                                    <span ng-show="item.owner.displayName != ''">
                                                        </br>
                                                        <b style="color: #286090">{{item.owner.displayName}}</b>
                                                    <b style="color: #286090" ng-show="item.owner.displayName == ''">{{item.ownerUsername}}</b>
                                                    <b class="pull-right">Owner</b>
                                                    </span>

                                                </td>
                                                <td>
                                                    <div class="col-md-12" ng-repeat="branch in item.branchList">
                                                        <b style="color: #20a03f">
                                                            {{branch.name}}</b>
                                                    </div>
                                                </td>
                                                <td>
                                                    <div class="col-md-6" ng-repeat="tag in item.tagList">
                                                        <b style="color: #20a03f">
                                                            {{tag.name}}</b>
                                                    </div>
                                                </td>
                                                <td ng-if="contains(authPoint, '/server/save')">
                                                    <button ng-click="editServer(item)"
                                                            class="btn btn-xs"
                                                            style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                        <span class="glyphicon glyphicon-edit"></span>编辑
                                                    </button>

                                                    <button ng-click="delServer(item)"
                                                            class="btn btn-xs pull-right"
                                                            style="background-color: red; color: white;">
                                                        <span class="glyphicon glyphicon-remove"></span>删除
                                                    </button>

                                                </td>
                                            </tr>
                                            </tbody>
                                            <tfoot>
                                            <tr>
                                                <td colspan="9">
                                                    <ul style="margin: 0px; float: right;" uib-pagination
                                                        total-items="totalItems" ng-model="currentPage"
                                                        items-per-page="pageLength" max-size="10"
                                                        ng-change="pageChanged()" previous-text="&lsaquo;"
                                                        next-text="&rsaquo;"></ul>
                                                </td>
                                            </tr>
                                            </tfoot>
                                        </table>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </uib-tab>
                <uib-tab index="1" heading="WebHooks">
                    <div class="panel panel-default" ng-controller="webHooksCtrl">
                        <div class="panel-body">
                            <form class="form-inline" role="form">
                                <div class="form-group">
                                    <div class="input-group">
                                        <span class="input-group-addon">项目名</span>
                                        <input type="text" class="form-control" ng-model="queryProjectName"
                                               placeholder="project">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="input-group">
                                        <span class="input-group-addon">分支</span>
                                        <input type="text" class="form-control" ng-model="queryRef"
                                               placeholder="branch or tag">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="input-group">
                                        <span class="input-group-addon">触发构建</span>
                                        <select class="form-control" ng-model="queryTriggerBuild"
                                                ng-options="triggerBuild.code as triggerBuild.name for triggerBuild in triggerBuildType">
                                            <option value="">--请选择--</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <button type="button" class="btn btn-info" ng-click="doQuery()"><span
                                            class="glyphicon glyphicon-search"></span>搜索
                                    </button>
                                    <button type="button" class="btn btn-info" ng-click="reSet()"><span
                                            class="glyphicon glyphicon-repeat"></span>重置
                                    </button>
                                </div>

                            </form>

                            <div class="panel panel-default" style="margin-top: 5px;;">
                                <div class="panel-body">
                                    <div>
                                        <table class="table table-hover table-bordered table-striped">
                                            <thead>
                                            <tr>
                                                <td>项目</td>
                                                <td>Ref</td>
                                                <td>Username</td>
                                                <td>TriggerBuild</td>
                                                <td>Body</td>
                                                <td>时间</td>
                                                <td ng-if="contains(authPoint, '/server/save')">操作</td>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <tr ng-repeat="item in pageData">
                                                <td>
                                                    <b style="color: #286090;"
                                                       uib-popover-html="item.description"
                                                       popover-trigger="'mouseenter'">{{item.projectName}}</b>
                                                </td>
                                                <td>
                                                    {{item.ref}}
                                                </td>
                                                <td>
                                                    {{item.userName}}
                                                </td>
                                                <td>
                                                    <b style="color: green;" ng-show="item.triggerBuild">触发</b>
                                                    <b ng-show="!item.triggerBuild">静默</b>
                                                </td>
                                                <td>
                                                    <div hljs hljs-source="item.webhooksBody"></div>
                                                </td>
                                                <td>{{(item.gmtModify == null || item.gmtModify == '') ? item.gmtCreate : item.gmtModify}}
                                                </td>
                                                <td ng-if="contains(authPoint, '/server/save')">
                                                    <button ng-click="editServer(item)"
                                                            class="btn btn-xs"
                                                            style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                                        <span class="glyphicon glyphicon-edit"></span>编辑
                                                    </button>

                                                    <button ng-click="delServer(item)"
                                                            class="btn btn-xs pull-right"
                                                            style="background-color: red; color: white;">
                                                        <span class="glyphicon glyphicon-remove"></span>删除
                                                    </button>

                                                </td>
                                            </tr>
                                            </tbody>
                                            <tfoot>
                                            <tr>
                                                <td colspan="9">
                                                    <ul style="margin: 0px; float: right;" uib-pagination
                                                        total-items="totalItems" ng-model="currentPage"
                                                        items-per-page="pageLength" max-size="10"
                                                        ng-change="pageChanged()" previous-text="&lsaquo;"
                                                        next-text="&rsaquo;"></ul>
                                                </td>
                                            </tr>
                                            </tfoot>
                                        </table>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </uib-tab>


            </uib-tabset>
        </div>
    </div>
    <!-- / main -->
</div>

